//
//  ProfileTableViewCell.m
//  ZooNgonDoiOS
//
//  Created by Trung sound on 7/25/12.
//  Copyright (c) 2012 Personal. All rights reserved.
//

#import "ProfileTableViewCell.h"

@implementation ProfileTableViewCell
@synthesize vImgAvatar = _vImgAvatar;
@synthesize vImgFood = _vImgFood;
@synthesize lbNameAtSpot = _lbNameAtSpot;
@synthesize lbAddress = _lbAddress;
@synthesize lbComment = _lbComment;
@synthesize lbTime = _lbTime;
@synthesize vImgComment = _vImgComment;


- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        UIImage *mainBackground = [UIImage imageNamed:IMG_CELLPROFILE_BACKGROUND];
        _viewMain = [[UIImageView alloc]initWithImage:mainBackground];
        _viewMain.frame = CGRectMake(10, 5, 301, 210);
        
        _viewInfo = [[UIView alloc]initWithFrame:CGRectMake(8, 8, 280, 40)];
        
        UIImageView *_vImgAvatarBg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:IMG_AVATARPROFILE_BACKGROUND]];
        _vImgAvatarBg.frame = CGRectMake(0, 0, 42, 42);
        
        _vImgAvatar = [[UIImageView alloc]initWithFrame:CGRectMake(1, 1, 40, 40)];
        [_vImgAvatarBg addSubview:_vImgAvatar];
        
        _lbNameAtSpot = [[UILabel alloc]initWithFrame:CGRectMake(50, 1, 230, 17)];
        [_lbNameAtSpot setBackgroundColor:[UIColor clearColor]];
        [_lbNameAtSpot setFont:[UIFont systemFontOfSize:14]];
        
        _lbAddress = [[UILabel alloc]initWithFrame:CGRectMake(50, 20, 230, 17)];
        [_lbAddress setFont:[UIFont systemFontOfSize:14]];
        [_lbAddress setBackgroundColor:[UIColor clearColor]];
        [_lbAddress setTextColor:[UIColor grayColor]];
        [_viewInfo addSubview:_vImgAvatarBg];
        [_viewInfo addSubview:_lbNameAtSpot];
        [_viewInfo addSubview:_lbAddress];
        
        _lbComment = [[UITextView alloc]initWithFrame:CGRectMake(8, 8, 260, 49)];
        [_lbComment setFont:[UIFont fontWithName:APP_MAIN_FONT size:18]];
        [_lbComment setBackgroundColor:[UIColor clearColor]];
        
        UIImage *commentBackground = [[UIImage imageNamed:IMG_COMMENT_BACKGROUND] resizableImageWithCapInsets:UIEdgeInsetsMake(15, 15, 15, 15)];

        _vImgComment = [[UIImageView alloc]initWithImage:commentBackground];
        _vImgComment.frame = CGRectMake(8, 49, 280, 49);
        
        [_vImgComment addSubview:_lbComment];
        
        _vImgFood = [[UIImageView alloc]initWithFrame:CGRectMake(10, 100, 301, 93)];
        
        _lbTime = [[ZooUILabel alloc]initWithFrame:CGRectMake(10, 193, 301, 24)];
        [_lbTime setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:IMG_TIMESPOT_BACKGROUND]]];
        [_lbTime setTextColor:[UIColor whiteColor]];
        [_lbTime setFont:[UIFont systemFontOfSize:12]];
        _lbTime.leftInset = 5;

        [_viewMain addSubview:_viewInfo];
        [_viewMain addSubview:_vImgComment];
        [_viewMain addSubview:_vImgFood];
        [_viewMain addSubview:_lbTime];
        
        [self addSubview:_viewMain];
        
        [_vImgAvatarBg release];
        [_lbNameAtSpot release];
        [_lbAddress release];

    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
